<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport"
          content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
    <title>查看批改作业</title>
    <link rel="stylesheet" href="../../../component/pear/css/pear.css"/>
</head>
<style>
    .layui-word-aux {
        color: #0C0C0C !important;
    }

    a {
        text-decoration: underline;
    }
</style>
<body class="pear-container">
<div class="layui-row layui-col-space10">
    <div class="layui-col-md12">
        <div class="layui-card">

                <blockquote class="layui-elem-quote layui-quote-nm"><h3>查看批改作业</h3></blockquote>
                <div class="layui-form-item">
                    <label class="layui-form-label">作业课程：</label>
                    <div class="layui-input-block">
                        <div id="courseName" class="layui-form-mid layui-word-aux">

                        </div>
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label">作业标题：</label>
                    <div class="layui-input-inline">
                        <div id="taskName" class="layui-form-mid layui-word-aux">

                        </div>
                    </div>
                </div>

            <div class="layui-form-item">
                <label class="layui-form-label">作业附件：</label>
                <div class="layui-input-inline">
                    <div id="homeworkFiles" class="layui-form-mid layui-word-aux">
                    </div>
                </div>
            </div>
            <div class="layui-card-header"><h3>作业内容</h3></div>
            <div class="layui-card-body" id="homeworkContent">
            </div>
            <hr style="border: solid 2px rgba(28,28,28,0.73);background-color: rgba(28,28,28,0.3)">

            <form class="layui-form" action="">
                <div class="layui-form-item">
                    <label class="layui-form-label">作业评分：</label>
                    <div class="layui-input-inline">
                        <input type="text" name="score" lay-verify="number" autocomplete="off"
                               placeholder="输入作业评分（百分制）" class="layui-input" >
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label">教师回复：</label>
                    <div class="layui-input-inline">
                        <textarea name="teacherComment"
                                  placeholder="输入作业回复或评语（选填）"
                                  class="layui-textarea"></textarea>
                    </div>
                </div>

            </form>
            <div class="layui-form-item">
                <div class="layui-input-block">
                    <button class="layui-btn" lay-submit lay-filter="taskSub">立即提交</button>
                </div>
                <input name="userId" type="hidden" id="userId">
                <input name="taskId" type="hidden" id="taskId">
            </div>



        </div>
    </div>
</div>
<script src="../../../component/layui/layui.js"></script>
<script src="../../../component/pear/pear.js"></script>
<script>
    layui.use(['form', 'jquery','loading'], function () {
        let form = layui.form;
        let $ = layui.jquery;
        let loading = layui.loading;

        form.on('submit(taskSub)',function (data){
            loading.Load(3, "");
            $.ajax({
                url: '/Task/teacherCorrectUploadTask',
                data: {
                    userId:data.field.userId,
                    taskId:data.field.taskId,
                    score:data.field.score,
                    teacherComment:data.field.teacherComment,
                },
                dataType: 'json',
                type: 'get',
                success: function (result) {
                    loading.loadRemove();
                    console.log((result));
                    if (result.success) {
                        console.log((result.success));
                        layer.msg(result.msg, {icon: 1, time: 1000}, function () {
                            parent.layer.close(parent.layer.getFrameIndex(window.name));//关闭当前页
                            parent.layui.table.reload("user-table", {
                                data: result.data,
                                page: {
                                    layout: ['count', 'prev', 'page', 'next', 'skip']
                                    , curr: parent.layui.jquery(".layui-laypage-em").next().html()
                                    , groups: 3
                                    , last: false
                                }
                            });
                        });
                    } else {
                        layer.msg(result.msg, {icon: 2, time: 1500});
                    }
                },
                error:function (res){
                    return false;
                }
            })
        })
        return false;

    });
</script>
</body>
</html>
